package com.david.dubbo.spi;

import com.david.dubbo.spi.service.DavidService;
import org.apache.dubbo.common.extension.ExtensionLoader;

import java.util.Set;

/**
 * @author David
 * @version V1.0
 * @Package com.david.dubbo.spi
 * @date 2021/4/11 16:46
 */
public class MainTest {
    public static void main(String[] args) {
        ExtensionLoader<DavidService> extensionLoader = ExtensionLoader.getExtensionLoader(DavidService.class);
        //获取扩展点名称集合
        Set<String> supportedExtensions = extensionLoader.getSupportedExtensions();
        for (String extension : supportedExtensions) {
            System.out.println("extension = " + extension);
            //遍历获取扩展的具体服务实现
            DavidService davidService = extensionLoader.getExtension(extension);
            davidService.doSomething();
        }
    }
}
